package com.wlsk.license.service.impl;

import com.wlsk.license.common.result.Result;
import com.wlsk.license.dao.mapper.PlateOwnerMapper;
import com.wlsk.license.dto.request.feign.OrgReqDto;
import com.wlsk.license.dto.response.feign.OrgResVo;
import com.wlsk.license.service.ITestService;
import com.wlsk.license.service.feign.MerchantFeignClient;
import com.wlsk.license.service.feign.PlatOssFeignClient;
import com.wlsk.license.service.feign.UserCenterClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class TestServiceImpl implements ITestService {
    @Autowired
    private PlateOwnerMapper plateOwnerMapper;//包车牌业户信息表;
    @Resource
    private MerchantFeignClient merchantFeignClient;//包车牌业户信息表;
    @Resource
    private PlatOssFeignClient platOssFeignClient;
    @Resource
    private UserCenterClient userCenterClient;
    @Override
    public void test() {
//        platOssFeignClient.uploadOssObject(null, 15);


//        QueryWrapper<PlateOwnerResultDto> wrapper = new QueryWrapper<>();
//        wrapper.eq("order_id", "34416");

//        PlateOwner existPlateOwner = plateOwnerMapper.selectList(reqDto.getPlateId());
//        List<PlateOwnerResultDto> list = plateOwnerMapper.selectList(wrapper); // ✅ 自动映射 + 脱敏

       /** Result<UserResDto> result = merchantFeignClient.getUserByUserId(UserReqDto.builder().uid(1895L).build());
        System.out.println( result);
        log.info("result:{}", result);
        Result<List> allMerchantInfo = merchantFeignClient.getAllMerchantInfo(MerchantReqDto.builder().merchantCode(result.getData().getOrgVo().getMerchantCode()).build());
        System.out.println( allMerchantInfo);
        log.info("result2:{}", allMerchantInfo); **/
/**
        EnterpriseInfoResult result = userCenterClient.queryEnterpriseInfoByCreditCode("916250000100000078");
        if(result != null && result.isSuccess() && result.getData() != null){
            EnterpriseInfoDto enterpriseInfo =  JSONObject.parseObject(JSONObject.toJSONString(result.getData()), EnterpriseInfoDto.class);
            log.info("enterpriseInfo:{}", enterpriseInfo);
        } **/
        Result<List<OrgResVo>> result = merchantFeignClient.orgList(OrgReqDto.builder().parentId(14L).listType("1").build());
        log.info("result:{}", result);
    }
}
